<?php
	/**
	 * @author		: Mauricio Amorim
	 * @date		: 15/07/2010
	 * @version		: 1.0
	 * @tabela		: highlights
	 * @content		: 	
	 * 
	 					id,
						active, 
						name,
						link,
						content,
						image_url,
						date,
						date_in,
						date_out,
						order

	 *
	 * @obs			: utiliza a tabela parametro para designar o idioma (tipo:label_ptbr)
	 */
//importa classes de apoio
include_once "library/facil3/core/modules/highlights/vo/HighLightsVO.class.php";
//importa classes de apoio
include_once "library/forum/modules/highlights/dao/GenericHighLightsDAO.class.php";

class GenericHighLightsVO extends HighLightsVO{
	public $array_image_std_obj = array();	
  	
  	function __construct($arrayFetchPost = NULL){
		//inicia funo de validacao
		parent::__construct($arrayFetchPost);
	}//end construct

	/**
	 * inicia internamente a DAO
	 * @return void
	 */
	public function startDAO(){
		$this->DAO = GenericHighLightsDAO::getInstance();
	}
	
	/**
	 * @desc retorna array de stdClass Image conforme o locale passado
	 * @param $locale
	 * @return array_images
	 */
	public function getImages($locale = NULL){
		//busca os links da tabela image(imagem)
		//Atenção deve ser passado o parametro como image para poder iniciar o dao de imagem corretamente
		$array_link_image = parent::getLinks("image", 1);
		//echo $this->__table;
		//Debug::print_r($array_link_image);
		if($this->array_image_std_obj == NULL){
			$this->array_image_std_obj = array();
			foreach($array_link_image as $link_image){
				//depois passar o Locale dentro do getLinkedVO
				//Debug::print_r($link_image);
				$link_image = $link_image->getLinkedVO();
				//Debug::print_r($link_image);
				if($link_image->success){
					if($link_image->result->getLocale() == $locale){
						$link_image = $link_image->result->toStdClass();
						$this->array_image_std_obj[] = $link_image;
					}
				}
			}
		}
		//Debug::print_r($array_link_image);exit();
		return $this->array_image_std_obj;
	}	
}